package com.usian.vo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 07 01 14 10
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo {

    /**
     *  1: 成功
     *  0：失败
     */
    Integer code;

    /**
     * 1：SUCCESS
     * 0：ERROR
     */
    String message;
    /**
     * 返回的数据
     */
    Object data;


    public ResultVo(Integer code, String message) {
        this.code = code;
        this.message = message;
    }




    public static ResultVo ok(Object data){
        return new ResultVo(1,"SUCCESS",data);
    }

    public static ResultVo ok(){
        return new ResultVo(1,"SUCCESS");
    }

    public static ResultVo error(String message){
        return new ResultVo(0,message);
    }
    public static ResultVo error(String message,Object data){
        return new ResultVo(0,message,data);
    }
    public static ResultVo error(){
        return new ResultVo(0,"ERROR");
    }

}
